<?php
// 根据一级返回二级
include 'base.php';
$onecat = $_POST['onecat'];

$sql = "SELECT * FROM `goods` where `cat_one_id`='$onecat' GROUP BY `cat_two_id` limit 5";

$res = $conn->query($sql);

$arr = array();
while($row = mysqli_fetch_assoc($res)) {
  
  array_push($arr, $row);
}

echo json_encode($arr);